/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package multi.agent.simulation.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Owner
 */
@Entity
@Table(name = "nodo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Nodo.findAll", query = "SELECT n FROM Nodo n"),
    @NamedQuery(name = "Nodo.findByNombre", query = "SELECT n FROM Nodo n WHERE n.nombre = :nombre"),
    @NamedQuery(name = "Nodo.findById", query = "SELECT n FROM Nodo n WHERE n.id = :id")})
public class Nodo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "nombre")
    private String nombre;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
        @OneToMany(cascade = CascadeType.ALL, mappedBy = "hasta")
    private Collection<Rutas> rutasCollection;
        @OneToMany(cascade = CascadeType.ALL, mappedBy = "desde")
    private Collection<Rutas> rutasCollection1;

    public Nodo() {
    }

    public Nodo(Integer id) {
        this.id = id;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @XmlTransient
    public Collection<Rutas> getRutasCollection() {
        return rutasCollection;
    }

    public void setRutasCollection(Collection<Rutas> rutasCollection) {
        this.rutasCollection = rutasCollection;
    }

    @XmlTransient
    public Collection<Rutas> getRutasCollection1() {
        return rutasCollection1;
    }

    public void setRutasCollection1(Collection<Rutas> rutasCollection1) {
        this.rutasCollection1 = rutasCollection1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Nodo)) {
            return false;
        }
        Nodo other = (Nodo) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "multi.agent.simulation.entity.Nodo[ id=" + id + " ]";
    }
    
}
